package org.achartengine.internal.chart;

import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.RectF;
import java.util.ArrayList;

/* loaded from: classes2.dex */
public class e extends a {
    private static final int a = 10;
    private org.achartengine.internal.model.c b;
    private org.achartengine.internal.renderer.a c;
    private int d;

    @Override // org.achartengine.internal.chart.a
    public int a(int i) {
        return 10;
    }

    public e(org.achartengine.internal.model.c cVar, org.achartengine.internal.renderer.a aVar) {
        this.b = cVar;
        this.c = aVar;
    }

    @Override // org.achartengine.internal.chart.a
    public void a(Canvas canvas, int i, int i2, int i3, int i4, Paint paint) {
        Paint paint2;
        e eVar = this;
        Paint paint3 = paint;
        paint3.setAntiAlias(eVar.c.q());
        paint3.setStyle(Paint.Style.FILL);
        paint3.setTextSize(eVar.c.g());
        int u = eVar.c.u();
        if (eVar.c.l() && u == 0) {
            u = i4 / 5;
        }
        int i5 = u;
        int i6 = i + i3;
        int b = eVar.b.b();
        String[] strArr = new String[b];
        for (int i7 = 0; i7 < b; i7++) {
            strArr[i7] = eVar.b.c(i7);
        }
        int a2 = eVar.c.m() ? a(canvas, eVar.c, strArr, i, i6, i2, i3, i4, i5, paint, true) : i5;
        int i8 = (i2 + i4) - a2;
        a(eVar.c, canvas, i, i2, i3, i4, paint, false, 0);
        eVar.d = 7;
        int min = Math.min(Math.abs(i6 - i), Math.abs(i8 - i2));
        double t = eVar.c.t();
        Double.isNaN(t);
        double d = b;
        Double.isNaN(d);
        double d2 = 0.2d / d;
        double d3 = min;
        Double.isNaN(d3);
        int i9 = (int) (t * 0.35d * d3);
        int i10 = (i + i6) / 2;
        int i11 = (i8 + i2) / 2;
        float f = i9;
        float f2 = f * 1.1f;
        ArrayList arrayList = new ArrayList();
        int i12 = i9;
        float f3 = 0.9f * f;
        int i13 = 0;
        while (i13 < b) {
            int d4 = eVar.b.d(i13);
            String[] strArr2 = new String[d4];
            double d5 = 0.0d;
            for (int i14 = 0; i14 < d4; i14++) {
                d5 += eVar.b.b(i13)[i14];
                strArr2[i14] = eVar.b.e(i13)[i14];
            }
            RectF rectF = new RectF(i10 - i12, i11 - i12, i10 + i12, i11 + i12);
            int i15 = 0;
            float f4 = 0.0f;
            while (i15 < d4) {
                paint3.setColor(eVar.c.a(i15).b());
                double d6 = (float) eVar.b.b(i13)[i15];
                Double.isNaN(d6);
                float f5 = (float) ((d6 / d5) * 360.0d);
                int i16 = i15;
                canvas.drawArc(rectF, f4, f5, true, paint);
                a(canvas, eVar.b.e(i13)[i16], eVar.c, arrayList, i10, i11, f3, f2, f4, f5, i, i6, paint);
                f4 += f5;
                i15 = i16 + 1;
                i12 = i12;
                f3 = f3;
                rectF = rectF;
                d4 = d4;
                i13 = i13;
                d3 = d3;
                strArr = strArr;
                b = b;
                eVar = this;
                paint3 = paint;
            }
            int i17 = i13;
            double d7 = d3;
            String[] strArr3 = strArr;
            int i18 = b;
            double d8 = i12;
            Double.isNaN(d7);
            double d9 = d7 * d2;
            Double.isNaN(d8);
            int i19 = (int) (d8 - d9);
            double d10 = f3;
            Double.isNaN(d10);
            f3 = (float) (d10 - (d9 - 2.0d));
            if (this.c.c() != 0) {
                paint2 = paint;
                paint2.setColor(this.c.c());
            } else {
                paint2 = paint;
                paint2.setColor(-1);
            }
            paint2.setStyle(Paint.Style.FILL);
            canvas.drawArc(new RectF(i10 - i19, i11 - i19, i10 + i19, i11 + i19), 0.0f, 360.0f, true, paint);
            i13 = i17 + 1;
            paint3 = paint2;
            eVar = this;
            d3 = d7;
            strArr = strArr3;
            b = i18;
            i12 = i19 - 1;
        }
        arrayList.clear();
        a(canvas, eVar.c, strArr, i, i6, i2, i3, i4, a2, paint, false);
    }

    @Override // org.achartengine.internal.chart.a
    public void a(Canvas canvas, org.achartengine.internal.renderer.b bVar, float f, float f2, int i, Paint paint) {
        int i2 = this.d - 1;
        this.d = i2;
        canvas.drawCircle((f + 10.0f) - i2, f2, i2, paint);
    }
}
